//
//  BaseModel.h
//  LBBase
//
//  Created by Gary on 15/7/1.
//  Copyright (c) 2015年 Lebo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Property.h"

#define kBaseModelIdDefault         -1
#define kBaseModelPropertyId        @"_id"
#define kBaseModelTableColumnId     @"id"

// property:属性名 value:属性值 type:属性类型 column:数据库列名
#define AddProperty(p, t, c) [dic setObject:[[Property alloc] initWithName:p type:t column:c] forKey:p]

@protocol BaseModelProtocol <NSObject>

+ (NSString *)tableName;

// key: 属性名  value: Property
+ (NSDictionary *)propertyDictionary;

// 创建该模型的表的sql语句
+ (NSString *)sql;

- (NSDictionary *)dictionaryOfPropertyAndValue;

@end

@interface BaseModel : NSObject <BaseModelProtocol, NSCopying>

@property long long _id;

/*
@property (nonatomic, copy) NSString *extend1;
@property (nonatomic, copy) NSString *extend2;
@property (nonatomic, copy) NSString *extend3;
@property (nonatomic, copy) NSString *extend4;
 */

/**
 * @brief 根据类的属性和值类型创建字典
 *
 * @param [in]
 * @param [out]
 * @return
 * @note
 */
+ (NSDictionary *)dictionaryOfpropertyAndValueWithClass:(BaseModel *)model
                                                   deep:(int)deep;

/**
 * @brief 根据类的属性和值类型创建字典
 *
 * @param [in]
 * @param [out]
 * @return
 * @note
 */

@end
